package com.fafa.swing.base;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;

/**
 * @author : fafa
 * @version V1.0
 * @Project: SwingTest
 * @Package com.fafa.swing
 * @Description: BorderLayoutDemo
 * @date Date : 2019年11月23日 10:52
 */
public class BorderLayoutDemo extends JFrame {
    public static void main(String[] args) {
        JFrame jFrame = new JFrame("第三个GUI窗体程序BorderLayout");
        jFrame.setBounds(300,300,500,500);
        jFrame.setLayout(new BorderLayout(10,10));   // 为JFrame窗体设置布局为BorderLayout
        JButton jButton1 = new JButton("上");
        JButton jButton2 = new JButton("下");
        JButton jButton3 = new JButton("中");
        JButton jButton4 = new JButton("左");
        JButton jButton5 = new JButton("右");
        jFrame.add(jButton1,BorderLayout.NORTH);
        jFrame.add(jButton2,BorderLayout.SOUTH);
        jFrame.add(jButton3,BorderLayout.CENTER);
        jFrame.add(jButton4,BorderLayout.WEST);
        jFrame.add(jButton5,BorderLayout.EAST);
        jFrame.setVisible(true);
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
